package com.rss.inbound.listeners;

import java.util.Properties;

import org.apache.log4j.Logger;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobExecutionListener;

public class JobListener implements JobExecutionListener
{
    Logger logger = Logger.getLogger(JobListener.class);
    @Override
    public void afterJob(JobExecution jobExecution)
    {
	logger.debug("Job ending");
    }
    @SuppressWarnings("restriction")
    @Override
    public void beforeJob(JobExecution jobExecution)
    {
	logger.debug("Setting proxies");
	//First set the Proxy settings on the System  
	    Properties systemSettings = System.getProperties();  
	    systemSettings.put("http.proxyHost","proxy.cognizant.com") ;  
	    systemSettings.put("http.proxyPort", "6050") ;
	    
	    //HttpURLConnection con = (HttpURLConnection) feedSource.openConnection();  
	        
	    //prepare the proxy autherization String  
	    sun.misc.BASE64Encoder encoder = new sun.misc.BASE64Encoder();  
	    String encodedUserPwd = encoder.encode(("199846" + ":" + "jamuna25#").getBytes());  
	    //get authorization from the proxy  
	    //con.setRequestProperty("Proxy-Authorization", "Basic " + encodedUserPwd);
        
    }
}
